package cn.cdeden.sys.domain;

import cn.cdeden.sys.domain.dto.SysParametersConfigDto;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.baomidou.mybatisplus.annotation.*;
import io.github.linpeilie.annotations.AutoMapper;
//import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Date;

/**
* @author Yu.
* @date 2023-01-30
*/
@Data
@Builder
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
@AutoMapper(target = SysParametersConfigDto.class)
@TableName("sys_parameters_config")
public class SysParametersConfig implements Serializable {
    private static final long serialVersionUID = 1L;

    @TableId(type= IdType.ASSIGN_UUID)
    private String id;

//    @ApiModelProperty(value = "系统配置编号")
    private String configCode;

//    @ApiModelProperty(value = "系统配置名称")
    private String configName;

//    @ApiModelProperty(value = "系统配置值")
    private String configValue;

//    @ApiModelProperty(value = "系统配置类型")
    private String configType;

//    @ApiModelProperty(value = "系统配置其他信息")
    private String configInfo;


//    @ApiModelProperty(value = "系统文件编号")
//    @TableField(exist = false)
    @TableField(updateStrategy= FieldStrategy.IGNORED)
    private String storageId;
//    @ApiModelProperty(value = "系统文件类型")
    @TableField(updateStrategy= FieldStrategy.IGNORED)
    private String storageType;
    @TableField(updateStrategy= FieldStrategy.IGNORED)
//    @ApiModelProperty(value = "系统文件地址")
    private String storageUrl;


//    @ApiModelProperty(value = "备注")
    private String configRemarks;

//    @ApiModelProperty(value = "排序字段")
    private Integer orderindex;

//    @ApiModelProperty(value = "数据状态")
    private String status;

//    @ApiModelProperty(value = "文件或者数据")
    private String type;

//    @ApiModelProperty(value = "数据显示类型给前端用")
    private String dataType;

//    @ApiModelProperty(value = "拥有者编号")
    @TableField(fill= FieldFill.INSERT)
    private String createId;

//    @ApiModelProperty(value = "创建者")
    @TableField(fill= FieldFill.INSERT)
    private String createBy;

//    @ApiModelProperty(value = "创建日期")
    @TableField(fill= FieldFill.INSERT)
    private Date createTime;

//    @ApiModelProperty(value = "更新编号")
    @TableField(fill= FieldFill.INSERT_UPDATE)
    private String updateId;

//    @ApiModelProperty(value = "更新者")
    @TableField(fill= FieldFill.INSERT_UPDATE)
    private String updateBy;

//    @ApiModelProperty(value = "更新时间")
    @TableField(fill= FieldFill.INSERT_UPDATE)
    private Date updateTime;

    public void copyFrom(SysParametersConfig source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }

    public SysParametersConfig clear(SysParametersConfig config){
        config.setId(null);
        config.setCreateId(null);
        config.setCreateBy(null);
        config.setCreateTime(null);
        config.setUpdateId(null);
        config.setUpdateBy(null);
        config.setUpdateTime(null);
        config.setStorageId(null);
        config.setStorageType(null);
        config.setStorageUrl(null);
        config.setUpdateTime(null);
        return config;
    }



}
